// var BASE_URL = "http://118.190.52.185:8080/";
var BASE_URL = "/";
var TOKEN = "";

var core = null;

window.initCommon = function(bui,filter) {

    core = bui;

    // console.log("token"+TOKEN);
    if(bui){
        var storage = bui.storage();
        var yhbm = storage.get("yhbm",0);
        bui.config.ajax = {
            headers: {
                token:storage.get("token",0)
            }
        };
    }
    if(filter != "0"){
        var yhbm = $$("yhbm");
        if(!yhbm || yhbm == ""){
            bui.load({ url: "../index.html"});
        }
    }

}

window.$$ = function(key) {
    if(core){
        var storage = bui.storage();
        return storage.get(key,0);
    }
    return "";
}

window.$$$ = function(value) {
    if(bui.typeof(value) == undefined || value == "undefined" || value == null ){
        return "";
    }
    return value;
}
function getCookie(cname) {
    var name = cname + "=";
    var decodedCookie = decodeURIComponent(document.cookie);
    var ca = decodedCookie.split(';');
    for(var i = 0; i <ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') {
            c = c.substring(1);
        }
        if (c.indexOf(name) == 0) {
            return c.substring(name.length, c.length);
        }
    }
    return "";
}

$("#indexsy").on("click", function (argument) {
    bui.load({ url: BASE_URL+"mobile/index"});
});
$("#point_rule").on("click", function (argument) {
    bui.load({ url: BASE_URL+"mobile/point_rule"});
});
$("#prize_rule").on("click", function (argument) {
    bui.load({ url: BASE_URL+"mobile/prize_rule"});
});
$("#hdrule").on("click", function (argument) {
    bui.load({ url: BASE_URL+"mobile/hdrule"});
});
$("#center").on("click", function (argument) {
    bui.load({ url: BASE_URL+"mobile/center"});
});